"""demo URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from django.urls import path, include
from rest_framework.documentation import include_docs_urls
# from django.urls import include
# import users.urls
from users import views

# urls.py是项目的url配置文件

"""
路由解析顺序:
1.从主路由文件中的urlpatterns列表中由上至下的顺序查找对应路由规则
路由命名与reverse反解析
在定义路由的时候，可以为路由命名，方便查找特定视图的具体路信息
1.在使用include函数定义路由时，可以使用namespace参数定义路由的命名空间，
"""

urlpatterns = [
    path('admin/', admin.site.urls),
    # path(r'users/', include('users.urls'))
    # 使用include 来将子应用users里的全部路由包含进工程路由中;
    # include函数除了可以传递字符串之外，
    # url(r'^users/', include('users.urls')),
    url(r'^users/', include('users.urls', namespace='users-list')),
    # url(r'^index/$', users.views.index)
    # url(r'^users/index/$', users.views.index),

    # reqresp
    url(r'^', include('reqresp.urls', namespace='reqresp')),

    # classview
    url(r'^', include('classview.urls', namespace='classview')),

    # BookTest
    url(r'^', include('BookTest.urls', namespace='BookTest')),
    url(r'^docs/', include_docs_urls(title='My  API  title'))
]
